//
//  ActionSheetViewController.m
//  ActionSheet
//

#import "ActionSheetViewController.h"

@implementation ActionSheetViewController

- (void)viewDidLoad {
    [super viewDidLoad];
	
	UIActionSheet *mySheet = [[UIActionSheet alloc]
							  initWithTitle:@"Email Deletion Options"
							  delegate:self
							  cancelButtonTitle:@"Cancel"
							  destructiveButtonTitle:@"Delete Everything"
							  otherButtonTitles:@"All Read Mail", @"Spam Only", nil];
	
	mySheet.actionSheetStyle = UIActionSheetStyleBlackOpaque;
	[mySheet showInView:self.view];
	
	[mySheet release];
}

- (void)actionSheet:(UIActionSheet *)actionSheet
clickedButtonAtIndex:(NSInteger)buttonIndex {
	
	BOOL cancelClicked = actionSheet.cancelButtonIndex == buttonIndex;
	BOOL destructiveClicked = actionSheet.destructiveButtonIndex
	== buttonIndex;
	
	NSLog(@"button with index %i clicked (cancel:%i, destructive:%i",
		  buttonIndex, cancelClicked, destructiveClicked);
}

- (void)dealloc {
    [super dealloc];
}

@end
